﻿using System.Collections.Generic;
using System.Linq;

namespace Solution.BusinessObject
{
    public class AuthorBO
    {
        public IEnumerable<Author> GetAuthorsInCategory(Author author)
        {
            var album = CommonBO.MasterEDM.Contents
                .FirstOrDefault(t => t.Author.Id == author.Id);

            var authors = CommonBO.MasterEDM.Contents
                .Where(t => t.Category.Id == album.Category.Id)
                .Select(t => t.Author)
                .Where(t=>t.Id != author.Id)
                .Distinct()
                .ToList();

            return authors;
        }
    }
}